Data from the Taiwan Economic Journal for the years 1999–2009 representing company bankruptcy based on the business regulations of the Taiwan Stock Exchange.
Deron Liang and Chih-Fong Tsai, deronliang '@' gmail.com; cftsai '@' mgt.ncu.edu.tw, National Central University, Taiwan The data was obtained from UCI Machine Learning Repository: https://archive.ics.uci.edu/ml/datasets/Taiwanese+Bankruptcy+Prediction
Liang, D., Lu, C.-C., Tsai, C.-F., and Shih, G.-A. (2016) Financial Ratios and Corporate Governance Indicators in Bankruptcy Prediction: A Comprehensive Study. European Journal of Operational Research, vol. 252, no. 2, pp. 561-572. https://www.sciencedirect.com/science/article/pii/S0377221716000412
import config
import pandas as pd
from numpy import log
from pandas.plotting import register_matplotlib_converters
from matplotlib.pyplot import figure, savefig, show, show, subplots, Axes, title
from ds_charts import bar_chart, get_variable_types, choose_grid, HEIGHT, multiple_line_chart
from pandas import DataFrame, Series
from seaborn import distplot, heatmap
from scipy.stats import norm, expon, lognorm
register_matplotlib_converters()
/Users/jose/.pyenv/versions/3.10.6/lib/python3.10/site-packages/pandas/compat/__init__.py:124: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError. warnings.warn(msg)
Pandas¶missing_values = ["NA", "n/a", "na", "?", "--"]
data = pd.read_csv('./data/taiwan.csv', sep=',', decimal='.', parse_dates=True, infer_datetime_format=True, na_values = missing_values)
data.describe()
| Bankrupt? | ROA(C) before interest and depreciation before interest | ROA(A) before interest and % after tax | ROA(B) before interest and depreciation after tax | Operating Gross Margin | Realized Sales Gross Margin | Operating Profit Rate | Pre-tax net Interest Rate | After-tax net Interest Rate | Non-industry income and expenditure/revenue | ... | Net Income to Total Assets | Total assets to GNP price | No-credit Interval | Gross Profit to Sales | Net Income to Stockholder's Equity | Liability to Equity | Degree of Financial Leverage (DFL) | Interest Coverage Ratio (Interest expense to EBIT) | Net Income Flag | Equity to Liability | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| count | 6819.000000 | 6819.000000 | 6819.000000 | 6819.000000 | 6819.000000 | 6819.000000 | 6819.000000 | 6819.000000 | 6819.000000 | 6819.000000 | ... | 6819.000000 | 6.819000e+03 | 6819.000000 | 6819.000000 | 6819.000000 | 6819.000000 | 6819.000000 | 6819.000000 | 6819.0 | 6819.000000 |
| mean | 0.032263 | 0.505180 | 0.558625 | 0.553589 | 0.607948 | 0.607929 | 0.998755 | 0.797190 | 0.809084 | 0.303623 | ... | 0.807760 | 1.862942e+07 | 0.623915 | 0.607946 | 0.840402 | 0.280365 | 0.027541 | 0.565358 | 1.0 | 0.047578 |
| std | 0.176710 | 0.060686 | 0.065620 | 0.061595 | 0.016934 | 0.016916 | 0.013010 | 0.012869 | 0.013601 | 0.011163 | ... | 0.040332 | 3.764501e+08 | 0.012290 | 0.016934 | 0.014523 | 0.014463 | 0.015668 | 0.013214 | 0.0 | 0.050014 |
| min | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | ... | 0.000000 | 0.000000e+00 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 1.0 | 0.000000 |
| 25% | 0.000000 | 0.476527 | 0.535543 | 0.527277 | 0.600445 | 0.600434 | 0.998969 | 0.797386 | 0.809312 | 0.303466 | ... | 0.796750 | 9.036205e-04 | 0.623636 | 0.600443 | 0.840115 | 0.276944 | 0.026791 | 0.565158 | 1.0 | 0.024477 |
| 50% | 0.000000 | 0.502706 | 0.559802 | 0.552278 | 0.605997 | 0.605976 | 0.999022 | 0.797464 | 0.809375 | 0.303525 | ... | 0.810619 | 2.085213e-03 | 0.623879 | 0.605998 | 0.841179 | 0.278778 | 0.026808 | 0.565252 | 1.0 | 0.033798 |
| 75% | 0.000000 | 0.535563 | 0.589157 | 0.584105 | 0.613914 | 0.613842 | 0.999095 | 0.797579 | 0.809469 | 0.303585 | ... | 0.826455 | 5.269777e-03 | 0.624168 | 0.613913 | 0.842357 | 0.281449 | 0.026913 | 0.565725 | 1.0 | 0.052838 |
| max | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | ... | 1.000000 | 9.820000e+09 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.000000 | 1.0 | 1.000000 |
8 rows × 96 columns
figure(figsize=(4,2))
values = {'# records': data.shape[0], '# variables': data.shape[1]}
bar_chart(list(values.keys()), list(values.values()), title='# of records vs # variables')
savefig('./images/records_variables.png')
show()
Inferring about the nature of the variables we have on our dataset.
data.dtypes
Bankrupt? int64
ROA(C) before interest and depreciation before interest float64
ROA(A) before interest and % after tax float64
ROA(B) before interest and depreciation after tax float64
Operating Gross Margin float64
...
Liability to Equity float64
Degree of Financial Leverage (DFL) float64
Interest Coverage Ratio (Interest expense to EBIT) float64
Net Income Flag int64
Equity to Liability float64
Length: 96, dtype: object
def get_variable_types(df: DataFrame) -> dict:
variable_types: dict = {
'Numeric': [],
'Binary': [],
'Date': [],
'Symbolic': []
}
for c in df.columns:
uniques = df[c].dropna(inplace=False).unique()
if len(uniques) == 2:
variable_types['Binary'].append(c)
df[c].astype('bool')
elif df[c].dtype == 'datetime64':
variable_types['Date'].append(c)
elif df[c].dtype == 'int':
variable_types['Numeric'].append(c)
elif df[c].dtype == 'float':
variable_types['Numeric'].append(c)
else:
df[c].astype('category')
variable_types['Symbolic'].append(c)
return variable_types
variable_types = get_variable_types(data)
print(variable_types)
counts = {}
for tp in variable_types.keys():
counts[tp] = len(variable_types[tp])
figure(figsize=(4,2))
bar_chart(list(counts.keys()), list(counts.values()), title='Nr of variables per type')
savefig('./images/variable_types.png')
show()
{'Numeric': [' ROA(C) before interest and depreciation before interest', ' ROA(A) before interest and % after tax', ' ROA(B) before interest and depreciation after tax', ' Operating Gross Margin', ' Realized Sales Gross Margin', ' Operating Profit Rate', ' Pre-tax net Interest Rate', ' After-tax net Interest Rate', ' Non-industry income and expenditure/revenue', ' Continuous interest rate (after tax)', ' Operating Expense Rate', ' Research and development expense rate', ' Cash flow rate', ' Interest-bearing debt interest rate', ' Tax rate (A)', ' Net Value Per Share (B)', ' Net Value Per Share (A)', ' Net Value Per Share (C)', ' Persistent EPS in the Last Four Seasons', ' Cash Flow Per Share', ' Revenue Per Share (Yuan ¥)', ' Operating Profit Per Share (Yuan ¥)', ' Per Share Net profit before tax (Yuan ¥)', ' Realized Sales Gross Profit Growth Rate', ' Operating Profit Growth Rate', ' After-tax Net Profit Growth Rate', ' Regular Net Profit Growth Rate', ' Continuous Net Profit Growth Rate', ' Total Asset Growth Rate', ' Net Value Growth Rate', ' Total Asset Return Growth Rate Ratio', ' Cash Reinvestment %', ' Current Ratio', ' Quick Ratio', ' Interest Expense Ratio', ' Total debt/Total net worth', ' Debt ratio %', ' Net worth/Assets', ' Long-term fund suitability ratio (A)', ' Borrowing dependency', ' Contingent liabilities/Net worth', ' Operating profit/Paid-in capital', ' Net profit before tax/Paid-in capital', ' Inventory and accounts receivable/Net value', ' Total Asset Turnover', ' Accounts Receivable Turnover', ' Average Collection Days', ' Inventory Turnover Rate (times)', ' Fixed Assets Turnover Frequency', ' Net Worth Turnover Rate (times)', ' Revenue per person', ' Operating profit per person', ' Allocation rate per person', ' Working Capital to Total Assets', ' Quick Assets/Total Assets', ' Current Assets/Total Assets', ' Cash/Total Assets', ' Quick Assets/Current Liability', ' Cash/Current Liability', ' Current Liability to Assets', ' Operating Funds to Liability', ' Inventory/Working Capital', ' Inventory/Current Liability', ' Current Liabilities/Liability', ' Working Capital/Equity', ' Current Liabilities/Equity', ' Long-term Liability to Current Assets', ' Retained Earnings to Total Assets', ' Total income/Total expense', ' Total expense/Assets', ' Current Asset Turnover Rate', ' Quick Asset Turnover Rate', ' Working capitcal Turnover Rate', ' Cash Turnover Rate', ' Cash Flow to Sales', ' Fixed Assets to Assets', ' Current Liability to Liability', ' Current Liability to Equity', ' Equity to Long-term Liability', ' Cash Flow to Total Assets', ' Cash Flow to Liability', ' CFO to Assets', ' Cash Flow to Equity', ' Current Liability to Current Assets', ' Net Income to Total Assets', ' Total assets to GNP price', ' No-credit Interval', ' Gross Profit to Sales', " Net Income to Stockholder's Equity", ' Liability to Equity', ' Degree of Financial Leverage (DFL)', ' Interest Coverage Ratio (Interest expense to EBIT)', ' Net Income Flag', ' Equity to Liability'], 'Binary': ['Bankrupt?', ' Liability-Assets Flag'], 'Date': [], 'Symbolic': []}
Simple analysis of the missing values.
mv = {}
for var in data:
nr = data[var].isnull().sum()
if nr > 0:
print(f'[!] Found {nr} missing values in {var}')
mv[var] = nr
if mv == {}:
print("No missing values found in dataset.")
No missing values found in dataset.
Simple analysis of the data distribution.
numeric_vars = get_variable_types(data)['Numeric']
if [] == numeric_vars:
raise ValueError('There are no numeric variables.')
rows, cols = choose_grid(len(numeric_vars))
fig, axs = subplots(rows, cols, figsize=(cols*HEIGHT, rows*HEIGHT), squeeze=False)
i, j = 0, 0
for n in range(len(numeric_vars)):
axs[i, j].set_title('Boxplot for %s'%numeric_vars[n])
axs[i, j].boxplot(data[numeric_vars[n]].dropna().values)
i, j = (i + 1, 0) if (n+1) % cols == 0 else (i, j + 1)
savefig('images/single_boxplots.png')
show()
Outliers using both the IQR and stdev critteria:
from matplotlib.pyplot import figure, savefig, show
from ds_charts import get_variable_types, multiple_bar_chart, HEIGHT
NR_STDEV: int = 2
numeric_vars = get_variable_types(data)['Numeric']
if [] == numeric_vars:
raise ValueError('There are no numeric variables.')
outliers_iqr = []
outliers_stdev = []
summary5 = data.describe(include='number')
for var in numeric_vars:
iqr = 1.5 * (summary5[var]['75%'] - summary5[var]['25%'])
outliers_iqr += [
data[data[var] > summary5[var]['75%'] + iqr].count()[var] +
data[data[var] < summary5[var]['25%'] - iqr].count()[var]]
std = NR_STDEV * summary5[var]['std']
outliers_stdev += [
data[data[var] > summary5[var]['mean'] + std].count()[var] +
data[data[var] < summary5[var]['mean'] - std].count()[var]]
outliers = {'iqr': outliers_iqr, 'stdev': outliers_stdev}
rows, cols = choose_grid(len(numeric_vars))
fig, axs = subplots(rows, cols, figsize=(cols*HEIGHT, rows*HEIGHT), squeeze=False)
i, j = 0, 0
width = 0.3
for n in range(len(numeric_vars)):
current_outliers = {'iqr': outliers['iqr'][n], 'stdev': outliers['stdev'][n]}
axs[i, j].set_title('Outliers for %s'%numeric_vars[n])
axs[i, j].bar(1 + width/2, outliers['iqr'][n], width, label='iqr')
axs[i, j].bar(1 - width/2, outliers['stdev'][n], width, label='stdev')
axs[i, j].legend()
i, j = (i + 1, 0) if (n+1) % cols == 0 else (i, j + 1)
savefig('images/single_outliers.png')
show()
Finding the matching possible distribution
numeric_vars = get_variable_types(data)['Numeric']
if [] == numeric_vars:
raise ValueError('There are no numeric variables.')
fig, axs = subplots(rows, cols, figsize=(cols*HEIGHT, rows*HEIGHT), squeeze=False)
i, j = 0, 0
for n in range(len(numeric_vars)):
axs[i, j].set_title('Histogram with trend for %s'%numeric_vars[n])
distplot(data[numeric_vars[n]].dropna().values, norm_hist=True, ax=axs[i, j], axlabel=numeric_vars[n])
i, j = (i + 1, 0) if (n+1) % cols == 0 else (i, j + 1)
savefig('images/histograms_trend_numeric.png')
show()
Let us try as well to match well known distributions
# def compute_known_distributions(x_values: list) -> dict:
# distributions = dict()
# # Gaussian
# mean, sigma = norm.fit(x_values)
# distributions['Normal(%.1f,%.2f)'%(mean,sigma)] = norm.pdf(x_values, mean, sigma)
# # Exponential
# loc, scale = expon.fit(x_values)
# distributions['Exp(%.2f)'%(1/scale)] = expon.pdf(x_values, loc, scale)
# # LogNorm
# sigma, loc, scale = lognorm.fit(x_values)
# distributions['LogNor(%.1f,%.2f)'%(log(scale),sigma)] = lognorm.pdf(x_values, sigma, loc, scale)
# return distributions
# def histogram_with_distributions(ax: Axes, series: Series, var: str):
# values = series.sort_values().values
# ax.hist(values, 20, density=True)
# distributions = compute_known_distributions(values)
# multiple_line_chart(values, distributions, ax=ax, title='Best fit for %s'%var, xlabel=var, ylabel='')
# numeric_vars = get_variable_types(data)['Numeric']
# if [] == numeric_vars:
# raise ValueError('There are no numeric variables.')
# fig, axs = subplots(rows, cols, figsize=(cols*HEIGHT, rows*HEIGHT), squeeze=False)
# i, j = 0, 0
# for n in range(len(numeric_vars)):
# histogram_with_distributions(axs[i, j], data[numeric_vars[n]].dropna(), numeric_vars[n])
# i, j = (i + 1, 0) if (n+1) % cols == 0 else (i, j + 1)
# savefig('images/histogram_numeric_distribution.png')
# show()
symbolic_vars = get_variable_types(data)['Symbolic']
if [] == symbolic_vars:
print('There are no symbolic variables.')
else:
rows, cols = choose_grid(len(symbolic_vars))
fig, axs = subplots(rows, cols, figsize=(cols*HEIGHT, rows*HEIGHT), squeeze=False)
i, j = 0, 0
for n in range(len(symbolic_vars)):
counts = data[symbolic_vars[n]].value_counts()
bar_chart(counts.index.to_list(), counts.values, ax=axs[i, j], title='Histogram for %s'%symbolic_vars[n], xlabel=symbolic_vars[n], ylabel='nr records', percentage=False)
i, j = (i + 1, 0) if (n+1) % cols == 0 else (i, j + 1)
savefig('images/histograms_symbolic.png')
show()
There are no symbolic variables.
# numeric_vars = get_variable_types(data)['Numeric']
# if [] == numeric_vars:
# raise ValueError('There are no numeric variables.')
# rows, cols = len(numeric_vars)-1, len(numeric_vars)-1
# fig, axs = subplots(rows, cols, figsize=(cols*HEIGHT, rows*HEIGHT), squeeze=False)
# for i in range(len(numeric_vars)):
# var1 = numeric_vars[i]
# for j in range(i+1, len(numeric_vars)):
# var2 = numeric_vars[j]
# axs[i, j-1].set_title("%s x %s"%(var1,var2))
# axs[i, j-1].set_xlabel(var1)
# axs[i, j-1].set_ylabel(var2)
# axs[i, j-1].scatter(data[var1], data[var2])
# savefig(f'images/sparsity_study_numeric.png')
# show()
corr_mtx = abs(data.corr())
print(corr_mtx)
Bankrupt? \
Bankrupt? 1.000000
ROA(C) before interest and depreciation before... 0.260807
ROA(A) before interest and % after tax 0.282941
ROA(B) before interest and depreciation after tax 0.273051
Operating Gross Margin 0.100043
... ...
Liability to Equity 0.166812
Degree of Financial Leverage (DFL) 0.010508
Interest Coverage Ratio (Interest expense to E... 0.005509
Net Income Flag NaN
Equity to Liability 0.083048
ROA(C) before interest and depreciation before interest \
Bankrupt? 0.260807
ROA(C) before interest and depreciation before... 1.000000
ROA(A) before interest and % after tax 0.940124
ROA(B) before interest and depreciation after tax 0.986849
Operating Gross Margin 0.334719
... ...
Liability to Equity 0.143629
Degree of Financial Leverage (DFL) 0.016575
Interest Coverage Ratio (Interest expense to E... 0.010573
Net Income Flag NaN
Equity to Liability 0.052416
ROA(A) before interest and % after tax \
Bankrupt? 0.282941
ROA(C) before interest and depreciation before... 0.940124
ROA(A) before interest and % after tax 1.000000
ROA(B) before interest and depreciation after tax 0.955741
Operating Gross Margin 0.326969
... ...
Liability to Equity 0.141039
Degree of Financial Leverage (DFL) 0.011515
Interest Coverage Ratio (Interest expense to E... 0.013372
Net Income Flag NaN
Equity to Liability 0.057887
ROA(B) before interest and depreciation after tax \
Bankrupt? 0.273051
ROA(C) before interest and depreciation before... 0.986849
ROA(A) before interest and % after tax 0.955741
ROA(B) before interest and depreciation after tax 1.000000
Operating Gross Margin 0.333749
... ...
Liability to Equity 0.142838
Degree of Financial Leverage (DFL) 0.014663
Interest Coverage Ratio (Interest expense to E... 0.011473
Net Income Flag NaN
Equity to Liability 0.056430
Operating Gross Margin \
Bankrupt? 0.100043
ROA(C) before interest and depreciation before... 0.334719
ROA(A) before interest and % after tax 0.326969
ROA(B) before interest and depreciation after tax 0.333749
Operating Gross Margin 1.000000
... ...
Liability to Equity 0.085434
Degree of Financial Leverage (DFL) 0.011806
Interest Coverage Ratio (Interest expense to E... 0.001167
Net Income Flag NaN
Equity to Liability 0.120029
Realized Sales Gross Margin \
Bankrupt? 0.099445
ROA(C) before interest and depreciation before... 0.332755
ROA(A) before interest and % after tax 0.324956
ROA(B) before interest and depreciation after tax 0.331755
Operating Gross Margin 0.999518
... ...
Liability to Equity 0.085407
Degree of Financial Leverage (DFL) 0.011268
Interest Coverage Ratio (Interest expense to E... 0.001158
Net Income Flag NaN
Equity to Liability 0.120196
Operating Profit Rate \
Bankrupt? 0.000230
ROA(C) before interest and depreciation before... 0.035725
ROA(A) before interest and % after tax 0.032053
ROA(B) before interest and depreciation after tax 0.035212
Operating Gross Margin 0.005745
... ...
Liability to Equity 0.001541
Degree of Financial Leverage (DFL) 0.000935
Interest Coverage Ratio (Interest expense to E... 0.000393
Net Income Flag NaN
Equity to Liability 0.017071
Pre-tax net Interest Rate \
Bankrupt? 0.008517
ROA(C) before interest and depreciation before... 0.053419
ROA(A) before interest and % after tax 0.053518
ROA(B) before interest and depreciation after tax 0.053726
Operating Gross Margin 0.032493
... ...
Liability to Equity 0.004043
Degree of Financial Leverage (DFL) 0.000855
Interest Coverage Ratio (Interest expense to E... 0.000984
Net Income Flag NaN
Equity to Liability 0.014559
After-tax net Interest Rate \
Bankrupt? 0.008857
ROA(C) before interest and depreciation before... 0.049222
ROA(A) before interest and % after tax 0.049474
ROA(B) before interest and depreciation after tax 0.049952
Operating Gross Margin 0.027175
... ...
Liability to Equity 0.004390
Degree of Financial Leverage (DFL) 0.000927
Interest Coverage Ratio (Interest expense to E... 0.000957
Net Income Flag NaN
Equity to Liability 0.010900
Non-industry income and expenditure/revenue \
Bankrupt? 0.016593
ROA(C) before interest and depreciation before... 0.020501
ROA(A) before interest and % after tax 0.029649
ROA(B) before interest and depreciation after tax 0.022366
Operating Gross Margin 0.051438
... ...
Liability to Equity 0.011899
Degree of Financial Leverage (DFL) 0.000556
Interest Coverage Ratio (Interest expense to E... 0.001024
Net Income Flag NaN
Equity to Liability 0.012293
... \
Bankrupt? ...
ROA(C) before interest and depreciation before... ...
ROA(A) before interest and % after tax ...
ROA(B) before interest and depreciation after tax ...
Operating Gross Margin ...
... ...
Liability to Equity ...
Degree of Financial Leverage (DFL) ...
Interest Coverage Ratio (Interest expense to E... ...
Net Income Flag ...
Equity to Liability ...
Net Income to Total Assets \
Bankrupt? 0.315457
ROA(C) before interest and depreciation before... 0.887670
ROA(A) before interest and % after tax 0.961552
ROA(B) before interest and depreciation after tax 0.912040
Operating Gross Margin 0.300143
... ...
Liability to Equity 0.159697
Degree of Financial Leverage (DFL) 0.010463
Interest Coverage Ratio (Interest expense to E... 0.012746
Net Income Flag NaN
Equity to Liability 0.073916
Total assets to GNP price \
Bankrupt? 0.035104
ROA(C) before interest and depreciation before... 0.071725
ROA(A) before interest and % after tax 0.098900
ROA(B) before interest and depreciation after tax 0.089088
Operating Gross Margin 0.022672
... ...
Liability to Equity 0.021982
Degree of Financial Leverage (DFL) 0.001881
Interest Coverage Ratio (Interest expense to E... 0.000239
Net Income Flag NaN
Equity to Liability 0.014871
No-credit Interval \
Bankrupt? 0.005547
ROA(C) before interest and depreciation before... 0.008135
ROA(A) before interest and % after tax 0.011463
ROA(B) before interest and depreciation after tax 0.007523
Operating Gross Margin 0.004205
... ...
Liability to Equity 0.003724
Degree of Financial Leverage (DFL) 0.008812
Interest Coverage Ratio (Interest expense to E... 0.001027
Net Income Flag NaN
Equity to Liability 0.050609
Gross Profit to Sales \
Bankrupt? 0.100044
ROA(C) before interest and depreciation before... 0.334721
ROA(A) before interest and % after tax 0.326971
ROA(B) before interest and depreciation after tax 0.333750
Operating Gross Margin 1.000000
... ...
Liability to Equity 0.085434
Degree of Financial Leverage (DFL) 0.011806
Interest Coverage Ratio (Interest expense to E... 0.001169
Net Income Flag NaN
Equity to Liability 0.120027
Net Income to Stockholder's Equity \
Bankrupt? 0.180987
ROA(C) before interest and depreciation before... 0.274287
ROA(A) before interest and % after tax 0.291744
ROA(B) before interest and depreciation after tax 0.280617
Operating Gross Margin 0.075304
... ...
Liability to Equity 0.791836
Degree of Financial Leverage (DFL) 0.000093
Interest Coverage Ratio (Interest expense to E... 0.005147
Net Income Flag NaN
Equity to Liability 0.029622
Liability to Equity \
Bankrupt? 0.166812
ROA(C) before interest and depreciation before... 0.143629
ROA(A) before interest and % after tax 0.141039
ROA(B) before interest and depreciation after tax 0.142838
Operating Gross Margin 0.085434
... ...
Liability to Equity 1.000000
Degree of Financial Leverage (DFL) 0.002119
Interest Coverage Ratio (Interest expense to E... 0.001487
Net Income Flag NaN
Equity to Liability 0.159654
Degree of Financial Leverage (DFL) \
Bankrupt? 0.010508
ROA(C) before interest and depreciation before... 0.016575
ROA(A) before interest and % after tax 0.011515
ROA(B) before interest and depreciation after tax 0.014663
Operating Gross Margin 0.011806
... ...
Liability to Equity 0.002119
Degree of Financial Leverage (DFL) 1.000000
Interest Coverage Ratio (Interest expense to E... 0.016513
Net Income Flag NaN
Equity to Liability 0.016739
Interest Coverage Ratio (Interest expense to EBIT) \
Bankrupt? 0.005509
ROA(C) before interest and depreciation before... 0.010573
ROA(A) before interest and % after tax 0.013372
ROA(B) before interest and depreciation after tax 0.011473
Operating Gross Margin 0.001167
... ...
Liability to Equity 0.001487
Degree of Financial Leverage (DFL) 0.016513
Interest Coverage Ratio (Interest expense to E... 1.000000
Net Income Flag NaN
Equity to Liability 0.008339
Net Income Flag \
Bankrupt? NaN
ROA(C) before interest and depreciation before... NaN
ROA(A) before interest and % after tax NaN
ROA(B) before interest and depreciation after tax NaN
Operating Gross Margin NaN
... ...
Liability to Equity NaN
Degree of Financial Leverage (DFL) NaN
Interest Coverage Ratio (Interest expense to E... NaN
Net Income Flag NaN
Equity to Liability NaN
Equity to Liability
Bankrupt? 0.083048
ROA(C) before interest and depreciation before... 0.052416
ROA(A) before interest and % after tax 0.057887
ROA(B) before interest and depreciation after tax 0.056430
Operating Gross Margin 0.120029
... ...
Liability to Equity 0.159654
Degree of Financial Leverage (DFL) 0.016739
Interest Coverage Ratio (Interest expense to E... 0.008339
Net Income Flag NaN
Equity to Liability 1.000000
[96 rows x 96 columns]
fig = figure(figsize=[120, 120])
heatmap(abs(corr_mtx), xticklabels=corr_mtx.columns, yticklabels=corr_mtx.columns, annot=True, cmap='Blues')
title('Correlation analysis')
savefig(f'images/correlation_analysis.png')
show()